﻿#pragma once
#include "UIInclude.h"
#include "GameCoreScriptBinder.h"
#include "Widget.h"

_NAMESPACE_BEGIN

/// UI模块的脚本绑定类

class UI_Binder
{
public:
	/// 单体类声明
	SINGLETON_HELPER(UI_Binder)

	UI_Binder();
};

/// UiSystem类
REGISTER_TYPEMETHODS(UiSystem)
{
	r=engine->RegisterObjectMethod(type,"void Initial()",asMETHOD(T,Initial), asCALL_THISCALL);	 assert( r >= 0 );
	r=engine->RegisterObjectMethod(type,"void CreateImage(const string&in,const string&in)",asMETHOD(T,CreateImage), asCALL_THISCALL);	 assert( r >= 0 );
	r=engine->RegisterObjectMethod(type,"void RootAddWindow(WidgetWindow@)",asMETHOD(T,RootAddWindow), asCALL_THISCALL);	 assert( r >= 0 );
	r=engine->RegisterObjectMethod(type,"void AddComboBoxItem(const string&in,const string&in,int)",asMETHOD(T,AddComboBoxItem), asCALL_THISCALL);	 assert( r >= 0 );
	r=engine->RegisterObjectMethod(type,"void AddListBoxItem(const string&in,const string&in,int)",asMETHOD(T,AddListBoxItem), asCALL_THISCALL);	 assert( r >= 0 );

	r=engine->RegisterObjectMethod(type,"WidgetListBox@ GetListBox(const string&in)",asMETHOD(T,GetListBox), asCALL_THISCALL);	 assert( r >= 0 );
	r=engine->RegisterObjectMethod(type,"WidgetComboBox@ GetComboBox(const string&in)",asMETHOD(T,GetComboBox), asCALL_THISCALL);	 assert( r >= 0 );
	r=engine->RegisterObjectMethod(type,"WidgetButton@ GetButton(const string&in)",asMETHOD(T,GetButton), asCALL_THISCALL);	 assert( r >= 0 );
	r=engine->RegisterObjectMethod(type,"WidgetRadioButton@ GetRadioButton(const string&in)",asMETHOD(T,GetRadioButton), asCALL_THISCALL);	 assert( r >= 0 );
	r=engine->RegisterObjectMethod(type,"WidgetEditBox@ GetEditBox(const string&in)",asMETHOD(T,GetEditBox), asCALL_THISCALL);	 assert( r >= 0 );
	r=engine->RegisterObjectMethod(type,"WidgetMultilineList@ GetMultilineList(const string&in)",asMETHOD(T,GetEditBox), asCALL_THISCALL);	 assert( r >= 0 );
}

/// WidgetWindow类
REGISTER_TYPEMETHODS(WidgetWindow)
{
	r=engine->RegisterObjectMethod(type,"void SetSize(float,float)",asMETHOD(T,SetSize), asCALL_THISCALL);	 assert( r >= 0 );
	r=engine->RegisterObjectMethod(type,"void SetPos(float,float)",asMETHOD(T,SetPos), asCALL_THISCALL);	 assert( r >= 0 );
	r=engine->RegisterObjectMethod(type,"void SetCenterPos(float,float)",asMETHOD(T,SetCenterPos), asCALL_THISCALL);	 assert( r >= 0 );
	r=engine->RegisterObjectMethod(type,"void SetClickEnabled(bool)",asMETHOD(T,SetClickEnabled), asCALL_THISCALL);	 assert( r >= 0 );
	r=engine->RegisterObjectMethod(type,"void SetProperty(const string&in,const string&in)",asMETHOD(T,SetProperty), asCALL_THISCALL);	 assert( r >= 0 );
	r=engine->RegisterObjectMethod(type,"void SetImage(const string&in)",asMETHOD(T,SetImage), asCALL_THISCALL);	 assert( r >= 0 );
	r=engine->RegisterObjectMethod(type,"void SetVisible(bool)",asMETHOD(T,SetVisible), asCALL_THISCALL);	 assert( r >= 0 );
	r=engine->RegisterObjectMethod(type,"bool IsVisible()",asMETHOD(T,IsVisible), asCALL_THISCALL);	 assert( r >= 0 );
	r=engine->RegisterObjectMethod(type,"bool AddChildWindow(WidgetWindow@)",asMETHOD(T,AddChildWindow), asCALL_THISCALL);	 assert( r >= 0 );
	r=engine->RegisterObjectMethod(type,"bool LoadLayout(const string&in)",asMETHOD(T,LoadLayout), asCALL_THISCALL);	 assert( r >= 0 );
	r=engine->RegisterObjectMethod(type,"void SetText(const string&in)",asMETHOD(T,SetText), asCALL_THISCALL);	 assert( r >= 0 );
	r=engine->RegisterObjectMethod(type,"void SetZOrderingEnabled(bool)",asMETHOD(T,SetZOrderingEnabled), asCALL_THISCALL);	 assert( r >= 0 );
	r=engine->RegisterObjectMethod(type,"void Activate()",asMETHOD(T,Activate), asCALL_THISCALL);	 assert( r >= 0 );
}

/// WidgetButton类
REGISTER_TYPEMETHODS(WidgetButton)
{
	BASEMETHODS(type,T,WidgetWindow)
	r = engine->RegisterObjectProperty(type, "ASEvent clickSlot",offsetof(T,clickSlot)); assert( r >= 0 );	
}

/// WidgetRadioButton类
REGISTER_TYPEMETHODS(WidgetRadioButton)
{
	BASEMETHODS(type,T,WidgetWindow)
		r = engine->RegisterObjectProperty(type, "ASEvent clickSlot",offsetof(T,clickSlot)); assert( r >= 0 );	
}

/// WidgetEditBox类
REGISTER_TYPEMETHODS(WidgetEditBox)
{
	BASEMETHODS(type,T,WidgetWindow)
	r = engine->RegisterObjectProperty(type, "ASEvent clickSlot",offsetof(T,clickSlot)); assert( r >= 0 );
	r = engine->RegisterObjectMethod(type,"void setTextMasked(bool setting)",asMETHOD(T,setTextMasked), asCALL_THISCALL);	 assert( r >= 0 );
	r = engine->RegisterObjectMethod(type,"void setValidationString(const string &validation_string)",asMETHOD(T,setValidationString), asCALL_THISCALL);	 assert( r >= 0 );
}


/// WidgetListBox类
REGISTER_TYPEMETHODS(WidgetListBox)
{
	BASEMETHODS(type,T,WidgetWindow)
	r = engine->RegisterObjectProperty(type, "ASEvent changeSelSlot",offsetof(T,changeSelSlot)); assert( r >= 0 );	
	r = engine->RegisterObjectMethod(type,"int GetSelectedCount()",asMETHOD(T,GetSelectedCount), asCALL_THISCALL);	 assert( r >= 0 );
	r = engine->RegisterObjectMethod(type,"void GetCurtSel(string&out)",asMETHOD(T,GetCurtSel), asCALL_THISCALL);	 assert( r >= 0 );
	r = engine->RegisterObjectMethod(type,"void AddItem(const string&in,int)",asMETHOD(T,AddItem), asCALL_THISCALL);	 assert( r >= 0 );
	r = engine->RegisterObjectMethod(type,"void ClearItems()",asMETHOD(T,ClearItems), asCALL_THISCALL);	 assert( r >= 0 );
}

/// WidgetComboBox类
REGISTER_TYPEMETHODS(WidgetComboBox)
{
	BASEMETHODS(type,T,WidgetWindow)
	r = engine->RegisterObjectProperty(type, "ASEvent changeSelSlot",offsetof(T,changeSelSlot)); assert( r >= 0 );	
	r = engine->RegisterObjectMethod(type,"void AddItem(const string&in,int)",asMETHOD(T,AddItem), asCALL_THISCALL);	 assert( r >= 0 );
	r = engine->RegisterObjectMethod(type,"void ClearItems( )",asMETHOD(T,ClearItems), asCALL_THISCALL);	 assert( r >= 0 );
	r = engine->RegisterObjectMethod(type,"void GetCurtSel(string&out)",asMETHOD(T,GetCurtSel), asCALL_THISCALL);	 assert( r >= 0 );
}

/// WidgetMultilineList类
REGISTER_TYPEMETHODS(WidgetMultilineList)
{
	BASEMETHODS(type,T,WidgetWindow)
	r = engine->RegisterObjectMethod(type,"void SetRowItem(const string&in,int,int)",asMETHOD(T,SetRowItem), asCALL_THISCALL);	 assert( r >= 0 );
	r = engine->RegisterObjectMethod(type,"void AddRow(int)",asMETHOD(T,AddRow), asCALL_THISCALL);	 assert( r >= 0 );
	r = engine->RegisterObjectMethod(type,"void ClearItems()",asMETHOD(T,ClearItems), asCALL_THISCALL);	 assert( r >= 0 );
	r = engine->RegisterObjectMethod(type,"int GetSelectedCount()",asMETHOD(T,GetSelectedCount), asCALL_THISCALL);	 assert( r >= 0 );
	r = engine->RegisterObjectMethod(type,"void GetCurtSel(string&out,int)",asMETHOD(T,GetCurtSel), asCALL_THISCALL);	 assert( r >= 0 );
}

_NAMESPACE_END